Skip to content

Conversation

Copy link

Copilot AI commented Sep 17, 2025

This PR implements comprehensive internationalization (i18n) support for the Rail Sign Generator application by replacing all hardcoded text with translation keys and providing translations for 5 languages.

Changes Made

Translation Files Updated

  • Enhanced en.json, zh-Hans.json, zh-Hant.json, ja.json, and ko.json with complete translation coverage
  • Added organized translation keys with proper namespacing (e.g., blocks.styles.specials.*)
  • Added new translation categories for prefixes, line types, and UI elements

Component Updates

  • window-header.tsx: Replaced hardcoded "Rail Sign Generator" title with t('head_bar.project_name')
  • signs.tsx: Complete i18n implementation including:
    • Imported useTranslation hook
    • Replaced all hardcoded Chinese text in specialStyleConfigs with translation keys
    • Updated UI buttons, labels, and section headers to use translation keys
    • Made prefix text for signage (To/开往, Next Station/下一站, Terminus/终点站) translatable
    • Updated footer copyright text with proper link handling

Languages Supported

  • English (en) - Default language
  • Simplified Chinese (zh-Hans) - 简体中文
  • Traditional Chinese (zh-Hant) - 繁體中文
  • Japanese (ja) - 日本語
  • Korean (ko) - 한국어

Translation Coverage

All user-facing text is now translatable:

  • Window header and main title
  • UI buttons ("Add New Block", "Download PNG", "Background Color")
  • Block configuration options ("Block", "Dividing Line", "Style")
  • Style selections ("Single Grid", "Exit Logo", "Toilet", "Line", etc.)
  • Special attribute labels ("Text Alignment", "Line Type", "Line Number", etc.)
  • Alignment options ("Align Right", "Align Center", "Align Left")
  • Line type options ("Normal Line", "Loop Line", "Terminal Station")
  • Yes/No radio button options
  • Sign prefix text that appears in generated graphics
  • Footer copyright notice

Technical Implementation

  • Uses useTranslation hook from react-i18next following existing patterns
  • Translation objects are properly reactive to language changes
  • Maintains full compatibility with existing rmg-runtime language switching system
  • All builds, tests, and linting continue to pass
  • No breaking changes to existing functionality

Language switching works through the RMG runtime system by setting rmg-runtime-language in localStorage or using URL parameters.

English UI

Fixes #6.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copy link
Author

Copilot AI commented Sep 17, 2025

@thekingofcity 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs.

I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review.

Co-authored-by: thekingofcity <3353040+thekingofcity@users.noreply.github.com>
Copilot AI changed the title [WIP] Add i18n translation Implement complete i18n translation for all UI text Sep 17, 2025
Copilot AI requested a review from thekingofcity September 17, 2025 07:08
Copilot finished work on behalf of thekingofcity September 17, 2025 07:08
@thekingofcity thekingofcity removed their assignment Sep 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add i18n translation

2 participants